from django.db import models

# Create your models here.
class Area(models.Model):
    """省区"""
    name = models.CharField(max_length=255, verbose_name='名称')
    parent = models.ForeignKey('self', on_delete=models.SET_NULL, related_name='subs', null=True, blank=True, verbose_name='上级行政区划分')#自关联的表，外键指向自身

    class Meta:
        db_table = 'tb_areas'
        verbose_name = '行政区划分'
        verbose_name_plural = '行政区划分'

    def __str__(self):
        return self.name